﻿@using System.Text
@using Coralcode.Adapter.StatVisit.Entity.Domains
@using Coralcode.Adapter.StatVisit.Entity.Enums
@using Coralcode.Utils.Basic
@using CoralNode.MvcClient.Helper
@{
    ViewBag.Title = "流量分析-统计报表";
    ViewBag.PageModule = "flow";
    ViewBag.CurrentPageUrl = "/m/statistic/flowreport?";
}
@Html.IncludePage("CoralAdmin/statistic", "_Left")
<!--content-->
    <div id="pbody">
        <div class="extra">
            @Html.IncludePage("CoralAdmin/statistic", "DateSelection")
            <div class="main-box mt_2 mb_2">
            	<div class="tab-visit clearfix">
                	<a href="/m/statistic/flow?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">访问趋势</a>
                    <a class="current" href="/m/statistic/flowreport?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">统计报表</a>
                    <a href="/m/statistic/flowlog?dateStart=@ViewBag.DateStart&dateEnd=@ViewBag.DateEnd&dateselect=@ViewBag.dateselecte">访问明细</a>
                </div>
                <div class="clearfix">
                	<div class="table_visit">
                    	<table width="100%" style="margin-top:2px;">
                        	<thead>
                            	<tr class="t_bg">
                                	<td width="10"></td>
                                    <td>时段</td>
                                    <td align="right">浏览次数(PV)</td>
                                    <td align="right">独立访客(UV)</td>
                                    <td align="right">IP</td>
                                    <td align="right">新独立访客</td>
                                    <td align="right">访问次数</td>
                                    <td align="right">人均浏览页数</td>
                                    <td align="right">平均访问深度</td>
                                    <td width="20"></td>
                                </tr>
                            </thead>
                            <tbody>
                                <tr class="count">
                                    <td></td>
                                    <td>全站统计</td>
                                    <td align="right">@Model.PageView</td>
                                    <td align="right">@Model.UniqueVisitor</td>
                                    <td align="right">@Model.IpCount</td>
                                    <td align="right">@Model.NewUniqueVisitor</td>
                                    <td align="right">@Model.SessionCount</td>
                                    <td align="right">@MathUtil.Round(Model.PageViewAverage)</td>
                                    <td align="right">@MathUtil.Round(Model.PageDepthAverage)</td>
                                    <td></td>
                                </tr>
                                @foreach (StatReportDomain report in ViewBag.Reports){
                                    if (report.ReportDate.DayOfWeek == DayOfWeek.Saturday || report.ReportDate.DayOfWeek == DayOfWeek.Sunday) {
                                        <tr class="bg_green">
                                            <td></td>
                                            @if(report.ReportDate.DayOfWeek == DayOfWeek.Saturday){
                                                <td>@report.ReportDate.ToString("yyyy-MM-dd") 星期六</td>
                                            }else{
                                                <td>@report.ReportDate.ToString("yyyy-MM-dd") 星期天</td>
                                            }
                                            <td align="right">@report.PageView</td>
                                            <td align="right">@report.UniqueVisitor</td>
                                            <td align="right">@report.IpCount</td>
                                            <td align="right">@report.NewUniqueVisitor</td>
                                            <td align="right">@report.SessionCount</td>
                                            <td align="right">@MathUtil.Round(report.PageViewAverage)</td>
                                            <td align="right">@MathUtil.Round(report.PageDepthAverage)</td>
                                            <td></td>
                                        </tr>
                                    } else {
                                        <tr>
                                            <td></td>
                                            <td>@report.ReportDate.ToString("yyyy-MM-dd")</td>
                                            <td align="right">@report.PageView</td>
                                            <td align="right">@report.UniqueVisitor</td>
                                            <td align="right">@report.IpCount</td>
                                            <td align="right">@report.NewUniqueVisitor</td>
                                            <td align="right">@report.SessionCount</td>
                                            <td align="right">@MathUtil.Round(report.PageViewAverage)</td>
                                            <td align="right">@MathUtil.Round(report.PageDepthAverage)</td>
                                            <td></td>
                                        </tr>
                                    }
                                }
                            </tbody>
                        </table>
                    </div>
                </div> 
            </div>
        </div>
    </div>